Position actuelle: Accueil> Catégories de fonctions> rand

rand

Générer un entier aléatoire
Nom:rand
Catégorie:mathématiques
Langage de programmation:php
Description en une ligne:Renvoie un entier aléatoire.

Définition et utilisation

rand() renvoie un entier aléatoire.

Exemple

Cet exemple renvoie des nombres aléatoires:

 <? Php
Echo ( Rand ( ) ;
Echo ( Rand ( ) ;
Echo ( Rand ( 10 , 100 ) )
?>

Essayez-le vous-même

grammaire

 Rand ( Min , Max )
paramètre décrire
min , max Facultatif. Spécifie la plage de nombres aléatoires générés.

illustrer

Si aucun paramètre facultatif MIN et MAX ne sont fournis, rand() renvoie un entier pseudo-aléatoire entre 0 et Rand_max. Par exemple, si vous voulez un nombre aléatoire entre 5 et 15 (y compris 5 et 15), utilisez rand(5, 15) .

Fonctions similaires
  • Convertir hexadécimal en décimal hexdec

    hexdec

    Convertirhexadécimal
  • Racine carrée sqrt

    sqrt

    Racinecarrée
  • Arctangle de deux paramètres atan2

    atan2

    Arctanglededeuxparam
  • Générer un entier aléatoire rand

    rand

    Générerunentieraléat
  • Trouver la valeur maximale max

    max

    Trouverlavaleurmaxim
  • Tangente hyperbolique tanh

    tanh

    Tangentehyperbolique
  • Calculez la longueur oblique d'un triangle droit hypot

    hypot

    Calculezlalongueurob
  • Sinus hyperbolique inverse asinh

    asinh

    Sinushyperboliqueinv
Articles populaires